package com.example.messageboard.mapper;

import com.example.messageboard.model.MessageInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2024-12-09
 * Time: 17:31
 */
@Mapper
public interface MessageInfoMapper {

//    发布留言
    @Insert("insert into message_info (`from`,`to`,message) " +
            "values ('${from}','${to}','${message}')")
    Integer insertMessage(MessageInfo messageInfo);

//    获取留言
    @Select("select `id`,`from` , `to` , message , create_time , " +
            "update_time from message_info where delete_flag =0")
    List<MessageInfo> selectAllList();
}
